package org.melanesia.converters;

import org.melanesia.converters.exceptions.ConversionException;

/**
 * JavaToJavaConverter is a base class for implementation of converters from one
 * to another java type. This converters are used in the process of mapping
 * ResultSet values to bean's properties, in case, when property type is
 * different than the value returned in ResultSet.
 *
 * @see org.melanesia.converters.TypeConverter#registerConverter(Class, Class,
 *      JavaToJavaConverter)
 *
 * @author marcin.kielar
 */
public abstract class JavaToJavaConverter {

    /**
     * Converts value from a form given by value into some other form.
     *
     * @param converterContext
     *            Reference to {@link org.melanesia.converters.TypeConverter}
     * @param value
     *            Value to convert
     * @return Converted value
     * @throws ConversionException when conversion fails
     */
    public abstract Object convert(TypeConverter converterContext, Object value) throws ConversionException;
}
